Okay, so the formula for finding an average die roll is simple enough.
So what about rerolls?
Say for example you're allowed to roll a dice twice and take the higher number. How do you calculate the average for that?
Average die roll w/rerolling
Moderator: Moderators
-
Lago PARANOIA
- Invincible Overlord
- Posts: 10555
- Joined: Thu Sep 25, 2008 3:00 am
Re: Average die roll w/rerolling
Last edited by ggroy on Sat Mar 13, 2010 8:16 pm, edited 1 time in total.
Re: Average die roll w/rerolling
Last edited by ggroy on Sat Mar 13, 2010 8:16 pm, edited 7 times in total.
-
TarkisFlux
- Duke
- Posts: 1147
- Joined: Sun Jun 22, 2008 9:44 pm
- Location: Magic Mountain, CA
- Contact:
With some measure of work.
If you get the single highest die from a pool, which rerolling a single die a few times counts as, you can use the following trick:
The probability of rolling "A or better" on Y number of dice numbered from 1 to X is:
( (X)^Y - (A-1)^Y ) / (X) ^ Y
If you really care about only the probability of rolling A, you need to subtract the probability of A+1 or better from the probability of A or better. Once you have the probability of each result, you multiply each probability by the result and sum for the average.
Example
This has some slightly technical limitations, but they're worth pointing out to save you headaches. You cannot use this if you are adding any of the dice together and you can't splice this into any probability for getting a result and then adding it to another one unless the rolls could be treated as separate events. You can't break up SR4 style dice pools into discrete chunks and try to apply this, because it doesn't cover the possibility that you'll get all of your hits in the first pile and none in the latter. So this would work for getting 5 or better on 3d6 and 7 or better on 2d8, and then multiplying through for the combined probability, but not for getting two dice of 5 or better from 4d6. You just don't cover all of the possible states completely enough to get real results out.
So, if you care about multiple dice, because they need to be high enough or you want to add some together, you need to do some real work determining which available states degenerate into which results, and then multiplying the size of each state's bin by the result of that state and dividing by the total number of states. determining which result they generate, and then figuring the average from there. Since you can't really cheat on the sticking of states into results for lots of complicated setups (4d6 toss lowest for example, who's average is 12.8 or something in case you were curious), your best bet is to get your hands dirty with a spreadsheet or coding.
If you get the single highest die from a pool, which rerolling a single die a few times counts as, you can use the following trick:
The probability of rolling "A or better" on Y number of dice numbered from 1 to X is:
( (X)^Y - (A-1)^Y ) / (X) ^ Y
If you really care about only the probability of rolling A, you need to subtract the probability of A+1 or better from the probability of A or better. Once you have the probability of each result, you multiply each probability by the result and sum for the average.
Example
6 or better on 3d6 is (6^3-5^3)/6^3 = (216-125)/216 = 42.13%
5 or better on 3d6 is (6^3-4^3)/6^3 = (216-64)/216 = 70.30%
5 exactly is 70.3%-42.13% = 28.17%
5 or better on 3d6 is (6^3-4^3)/6^3 = (216-64)/216 = 70.30%
5 exactly is 70.3%-42.13% = 28.17%
So, if you care about multiple dice, because they need to be high enough or you want to add some together, you need to do some real work determining which available states degenerate into which results, and then multiplying the size of each state's bin by the result of that state and dividing by the total number of states. determining which result they generate, and then figuring the average from there. Since you can't really cheat on the sticking of states into results for lots of complicated setups (4d6 toss lowest for example, who's average is 12.8 or something in case you were curious), your best bet is to get your hands dirty with a spreadsheet or coding.
Last edited by TarkisFlux on Thu Jul 16, 2009 2:36 am, edited 1 time in total.
The wiki you should be linking to when you need a wiki link - http://www.dnd-wiki.org
Fectin: "Ant, what is best in life?"
Ant: "Ethically, a task well-completed for the good of the colony. Experientially, endorphins."
Fectin: "Ant, what is best in life?"
Ant: "Ethically, a task well-completed for the good of the colony. Experientially, endorphins."
-
Heath Robinson
- Knight
- Posts: 393
- Joined: Sun Aug 17, 2008 9:26 am
- Location: Blighty
An optimised procedure is to Sum (2x^2 - x) for x = [1,n] then divide the final result by n^2.
For 1d6 (rerolled)
For multiple dice, just add the Expectations of each individual dice.
Code: Select all
let X be the distribution of the first roll
let Y be the distribution of the second roll
let f be a function that transforms its two argument distributions into a single distribution that reflects the reroll behaviour
P( X = x) = 1/n
P( Y <= y) = y/n
P( X = x & Y <= x) = (1/n) * (x/n) = x/(n^2)
P( X = x & Y = x+i) = (1/n) * (1/n) = 1/(n^2)
E( f( x, Y)) = x * P( X = x & Y <= x) + Sum( ForEach i in [1, n-x] : (x + i) * P( X = x & Y = x + i))
= x^2 / n^2 + Sum( ForEach i in [1, n-x] : (x + i) / n^2)
let y = x+i
E( f( x, Y)) = x^2 / n^s + Sum( ForEach y in [x+1, n] : y / n^2)
The contribution that y makes to the E( f( X, Y)) is (y-1)y / n^2 because E( f( X, Y)) = Sum( ForEach x in [1, n] : E( f( x, Y)))
Each value of x adds y/n^2 for all values x < y <= n.
To demonstrate, it's intuitively obvious that 2 only contributes to E when x = 1, hence it only contributes once. When y = 3, it contributes when x is 1, or 2. Hence, 2.
E( f( X, Y)) = Sum( ForEach x in [1, n] : x^2/n^2) + Sum( ForEach y in [1, n] : y(y-1) / n^2)
= Sum( ForEach x in [1,n] : x^2/n^2 + x(x-1)/n^2)
= Sum( ForEach x in [1,n] : x^x + x(x-1)) / n^2
= Sum( ForEach x in [1,n] : 2x^2 - x) / n^2
Code: Select all
x = 1 : 2 * 1 - 1 = 1
x = 2 : 2 * 4 - 2 = 6
x = 3 : 2 * 9 - 3 = 15
x = 4 : 2 * 16 - 4 = 28
x = 5 : 2 * 25 - 5 = 45
x = 6 : 2 * 36 - 6 = 66
Sum = 161
Divided = 161 / 36 = 4.472...
Last edited by Heath Robinson on Thu Jul 16, 2009 11:55 am, edited 4 times in total.
Face it. Today will be as bad a day as any other.